package com.ivan.stu.notetool.activity;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;

import com.ivan.stu.notetool.R;


public class ThemeActivity extends AppCompatActivity {

    private Toolbar toolbar;
    private SharedPreferences userSettings;

    @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.lgnotelib_activity_theme);


    }

    @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
    public  void setToolBar(Context context) {

        toolbar = findViewById(R.id.toolbar);
        userSettings = getSharedPreferences("setting", 0);
        int background = userSettings.getInt("background",R.mipmap.notetool_head_bg);
        Resources resources = context.getResources();
        Drawable drawable = resources.getDrawable(background);
        toolbar.setBackground(drawable);

    }
}
